<?php
    function __autoload($class_name)
	{
		include_once('../classes/'.strtolower($class_name).'.php');
	}
    
    $Loi = false;
	
    $TenLoaiSanPhamCap2 = $_POST['TenLoaiSanPhamCap2'];
    $MaLoaiSanPhamCap1 = $_POST['MaLoaiSanPhamCap1'];
		    
    $loaisanphamcap2 = new loaisanphamc2bs();
    $loaisanphamcap2->TenLoaiSanPhamCap2 = $TenLoaiSanPhamCap2;
    $loaisanphamcap2->MaLoaiSanPhamCap1 = $MaLoaiSanPhamCap1;
    $isset = $loaisanphamcap2->issetType();
    
    if($isset[0]['SoDong'] > 0)
        $Loi = true;
    
    if($Loi == false)
    {
        if($loaisanphamcap2->add())
            echo "yes";
        else
            echo "no";
    }
    else
    {
        echo "no";
    }
?>